import request from '@/services/index'

// 获取餐品的分页列表
export const getProductList = (count=1)=>{  // count 是分页的页码
    // console.log('getProductList');
    // return request.get('/pro/list',{params:{const:page}})
    // return request.get('/pro/list',{params:{const}})
    // return request.get('/pro/list?count'+count)
    return request({
        url:'/pro/list',
        method:'get',
        params:{count}
    })
}

// 登录请求
export const login=(data)=>{    // data里传过来的 loginname和 password
    return request({
        url:'/user/login',
        method:'post',
        data
    })
}

// 详情页请求
export const detail = (proid) => {
    return request.get('pro/detail/' + proid)
}

//  京东秒杀请求
export const seckillList = ({count,liminNum}) => {
    return request({
        url:'pro/seckilllist',
        method:'get',
        params:{
            count,
            liminNum
        }
    })
}
//  京东秒杀请求
// export const seckillList = (data) => {
//     return request({
//         url:'pro/seckilllist',
//         method:'get',
//         params:data
//     })
// }

// 购物车请求
export const car = (data) => {
    return request({
        url:'cart/list',
        method:'get',
        params:data
    })
}

// 推荐列表请求
export const getRecommend = (data) => {
    return request({
        url:'/pro/recommendlist',
        method:'get',
        params:data
    })
}

// 获取加入购物车
export const getAddCart = (data) =>{
  return request({
        url:'/cart/add',
        method:'post',
        data
    })
}